const fetchData = useCallback(async (params) => {
  const res = await axios.get('/url', { params })
  appDispatch({ type: 'LOAD_ELEMENTS', elements: res.data })
}, [])

useEffect(() => {
  fetchData()
}, [fetchData])
